package com.qububu.common.notice.dto;

import java.util.Arrays;

import com.qububu.utils.DateUtil;
import com.qububu.utils.SystemUtil;

public class NoticeInfoDto {

	private NoticeType noticeType;
	private String noticeId;
	private String noticeTitle;
	private String noticeContent;
	private String noticePicUrl;
	private int noticeCreateDttm;
	private String noticeSummaryText;
	
	public String getNoticeSummaryText() {
		return noticeSummaryText;
	}
	public void setNoticeSummaryText(String noticeSummaryText) {
		this.noticeSummaryText = noticeSummaryText;
	}
	/**
	 * @功能 id处理
	 * @return
	 */
	public NoticeInfoDto(String noticeId){
		this.noticeId = noticeId;
	}
	public NoticeInfoDto(long noticeId){
		this.noticeId = SystemUtil.encrypt(String.valueOf(noticeId));
	}
	
	/**
	 * @功能 时间处理
	 */
	public String showNoticeCreateDttmInString() {
//		return DateUtil.formatToDTTMString(noticeCreateDttm);
		return DateUtil.formatDTString(noticeCreateDttm);
	}
	
	/**
	 * @功能 noticeType处理
	 * @return
	 */
	public enum NoticeType{
		SITE(0),
		COMMUNITY(1);
		
		private int intValue;
		private NoticeType(int intValue) {
			this.intValue = intValue;
		}
		
		/**
		 * 根据传入字符串来返回对应的状态类型
		 */
		public static NoticeType getNoticeType(String strValue){
			try {
				NoticeType type = valueOf(strValue);
				return type;
				
			} catch (Exception e) {
				// TODO: handle exception
				throw new IllegalArgumentException("Value '" + strValue + "' is not allowed in NoticeType. Only "
						+ Arrays.toString(NoticeType.values()) + " are allowed."
						);
			}
		}
		
		/**
		 * 根据传入INT值来返回对应的状态类型
		 */
		public static NoticeType getNoticeType(int intValue) {
			for (NoticeType elem : NoticeType.values()) {
				if (elem.toIntValue() == intValue) {
					return elem;
				}
			}

			throw new IllegalArgumentException("Value '" + intValue
					+ "' is not allowed in Notice.");
		}
		
		/**
		 * 返回int值类型。
		 * @return
		 */
		public int toIntValue() {
			return intValue;
		}
	}
	
	public String getNoticeTitle() {
		return noticeTitle;
	}
	public void setNoticeTitle(String noticeTitle) {
		this.noticeTitle = noticeTitle;
	}
	public String getNoticeContent() {
		return noticeContent;
	}
	public void setNoticeContent(String noticeContent) {
		this.noticeContent = noticeContent;
	}
	public String getNoticePicUrl() {
		return noticePicUrl;
	}
	public void setNoticePicUrl(String noticePicUrl) {
		this.noticePicUrl = noticePicUrl;
	}
	public int getNoticeCreateDttm() {
		return noticeCreateDttm;
	}
	public void setNoticeCreateDttm(int noticeCreateDttm) {
		this.noticeCreateDttm = noticeCreateDttm;
	}
	public String getNoticeId() {
		return noticeId;
	}
	public NoticeType getNoticeType() {
		return noticeType;
	}
	public void setNoticeType(NoticeType noticeType) {
		this.noticeType = noticeType;
	}
	
}
